import "babel-polyfill";
import '../scss/common.scss';
import { IndexModel } from '../models/index';

class App{
    constructor($,options){
        this.$app = $('<div id="app">');
        this.swiper = options.swiper;
        this.field = options.field;
        this.phone = options.phone;
        this.cache = {};
        this.init();
     
    }
    async init(){
       await this.getDatas();
             this.render();
            
       }
       async getDatas(){
          const indexModel = new IndexModel();
              await indexModel.getDatas({
                    swiper:this.swiper,
                    phone:this.phone,
                    field: this.field
                }).then((res) => {
                  this.cache={
                     phoneDatas:res.phone_data,
                     swiperDatas:res.swiper_data,
                     fieldDatas:res.field_data
               }
          })
    }

}
export{ App }